<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
    wx.config({
        debug: false,
        appId: '<?php echo $this->_data["row"]["appId"]; ?>',
        timestamp: <?php echo $this->_data["row"]["timestamp"]; ?>,
        nonceStr: '<?php echo $this->_data["row"]["nonceStr"]; ?>',
        signature: '<?php echo $this->_data["row"]["signature"]; ?>',
        jsApiList: [
            'getLocation',
        ]
    });
    wx.ready(function () {
        wx.checkJsApi({
            jsApiList: [
                'getLocation'
            ],
            success: function (res) {

                if (res.checkResult.getLocation == false) {
                    alert('你的微信版本太低，不支持微信JS接口，请升级到最新的微信版本！');
                    return;
                }
            }
        });
        wx.error(function(res){
            alert("接口调取失败")
        });
        wx.getLocation({
            success: function (res) {
                var lat = res.latitude;
                var lng = res.longitude;
                document.getElementById("latlng").value=lat+","+lng;

            },
            cancel: function (res) {
                alert('用户拒绝授权获取地理位置');
            }
        });
    });
</script>
<input type="text" value="" id="latlng"/>
</body>
</html>